package com.gaofeng.day11;

/**
 * @author gaofeng
 * @date 2024-12-22 - 22:01
 */
public class demo13 {
    public static void main(String[] args) {
      int[] arr = {1,2,3,4,5,6,7};
      int[] res = copyArr(arr,2,5);
      //      System.out.println(res);
        for (int i = 0; i < res.length; i++) {
            System.out.print(res[i]+" ");
        }
    }

    public static int[] copyArr(int[] arr,int from,int to) {
        int[] newArr = new int[to-from];
        int index = 0;
        for (int i = from; i < to; i++) {
            newArr[index] = arr[i];
            index++;
        }
        return newArr;
    }
}
